<template>
  <div id="app">
    <keep-alive :include="keepAlive">
      <router-view class="child-view"></router-view>
    </keep-alive>
  </div>
</template>
<script>
  import {mapMutations} from 'vuex'
  export default {
    name: 'app',
    data () {
      return {
        keepAlive: []
      }
    },
    created () {
      // this.$router.push({name: 'user'})
    },
    mounted () {
      /**
       * 更新设备宽度, resize变化时，防止频繁执行回调函数
       */
      let $win = $(window)
      let winWidth = $(window).width()
      this.updateDeviceWidth(winWidth)
      $win.resize(_.debounce(() => {
        this.updateDeviceWidth(winWidth)
      }, 100, {
        leading: true // 延时开始前调用
      }))
    },
    methods: {
      ...mapMutations(['updateDeviceWidth', 'updateScrollBottom'])
    }
  }
</script>
<style lang="less">
  @import './assets/less/_mixins-wln.less';
  #app {
    position: relative;
  }
  .child-view {
    box-sizing: border-box;
    /*transition: all .3s cubic-bezier(.55, 0, .1, 1);*/
  }
</style>
